package sy.po;

import java.util.Date;
import java.util.UUID;

import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Name;

/**
 * 所有模型都要继承此类，获得一些公共的数据表字段
 * 
 * @author 孙宇
 *
 */
public class BaseModel {

	@Name
	@Comment("uuid主键")
	@ColDefine(width = 36, notNull = true)
	private String id = UUID.randomUUID().toString();

	@Column
	@Comment("创建时间")
	@ColDefine(type = ColType.TIMESTAMP, notNull = true)
	private Date created = new Date();

	@Column
	@Comment("最后修改时间")
	@ColDefine(type = ColType.TIMESTAMP, notNull = true)
	private Date modified = new Date();

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getModified() {
		return new Date();
	}

	public void setModified(Date modified) {
		this.modified = modified;
	}

}
